const SERVICE = require("../../service.js");


Page({
  data:{
    ActiveNavItem: 0
  },
  onLoad(options){
    let _this = this;
    wx.showNavigationBarLoading();
    SERVICE.payPage({
    },(status,res)=>{
      console.log(res);
      wx.hideNavigationBarLoading();
      if(status){
        let data = res.data;
        _this.setData({
          today: data.open == 1 ? data.time : data.all_time,
          data: res.data,
          options: options
        });
      }
    });
  },

  /*分享*/
  onShareAppMessage(){

  },
  getNavItem(e){
    let index = e.currentTarget.dataset.index;
   
    this.setData({
      ActiveNavItem: index
    });
  },
  fromSubmit(e){
    let td = this.data, date = td.data.date[td.ActiveNavItem], form_obj = e.detail.value;
    if (!form_obj.radio_group){
      wx.showToast({
        title: "请选择配送时间",
        icon: "none",
        mask: true
      });
    }else{
      wx.navigateTo({
        url: "../pay/pay?orderData=" + td.options.orderData + "&remark=" + td.options.remark + "&date=" + date + ' ' + form_obj.radio_group,
      })
    }
  }
});